/*
 * Copyright 2025 The JA-SIG Collaborative. All rights reserved.
 * distributed with this file and available online at
 */
package com.lap.auth.application.module.assembler;

import com.lap.auth.application.module.command.CreateModuleCmd;
import com.lap.auth.application.module.command.UpdateModuleCmd;
import com.lap.auth.domain.module.Module;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring")
public interface ModuleAssembler {

  @Mapping(target = "createTime", ignore = true)
  @Mapping(target = "version", constant = "1")
  Module toDomain(CreateModuleCmd cmd);

  @Mapping(target = "createdBy", ignore = true)
  @Mapping(target = "createTime", ignore = true)
  @Mapping(target = "routeId", source = "routeId")
  Module toDomain(Integer id, String routeId, UpdateModuleCmd cmd);
}
